package com.breadenglish.cms.api.app.gateway.model;

import com.breadenglish.cms.api.app.gateway.util.CustomDateSerializer;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.jsondoc.core.annotation.ApiObject;
import org.jsondoc.core.annotation.ApiObjectField;

import java.util.Collection;
import java.util.Date;

/**
 * Created by jiangkun on 15/12/21.
 */
@ApiObject
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class BeVip {
    @ApiObjectField(description = "ID,客户端根据此id缓存已读状态与缓存语音文件文件夹名")
    private int id;

    @ApiObjectField(description = "标题,微信组名")
    private String title;

    @ApiObjectField(description = "学习内容或主题")
    private String content;

    @ApiObjectField(description = "时间段,微信组名中也含有此部分")
    private String timeQuantum;

    @ApiObjectField(description = "日期,上课日期")
    @JsonSerialize(using = CustomDateSerializer.class)
    private Date dt;

    @ApiObjectField(description = "语音文件地址(zip包,需要全部下载,mp3文件名称按数字升序就是聊天记录顺序)")
    private String audioUrl;

    @ApiObjectField(description = "聊天记录")
    private Collection<BeVipChatLog> chatLogs;

    @ApiObjectField(description = "老师姓名(英文名称)")
    private String teacher;

    @ApiObjectField(description = "老师头像图片地址")
    private String teacherIcon;

    @ApiObjectField(description = "读取状态,0:已读 1:未读")
    private boolean unread;

    @ApiObjectField(description = "状态,1:未上,2:已上,3:缺勤,4:补课")
    private int state;

    public static BeVip build(int id, String title, String content, String timeQuantum, Date dt, String teacher, String teacherIcon, boolean unread, int state) {
        BeVip beVip = new BeVip();
        beVip.id = id;
        beVip.title = title;
        beVip.content = content;
        beVip.timeQuantum = timeQuantum;
        beVip.dt = dt;
        beVip.teacher = teacher;
        beVip.teacherIcon = teacherIcon;
        beVip.unread = unread;
        beVip.state = state;
        return beVip;
    }

    public static BeVip buildDetails(int id, String title, String content, String timeQuantum, Date dt, String audioUrl, Collection<BeVipChatLog> chatLogs, String teacher, String teacherIcon, boolean unread, int state) {
        BeVip beVip = new BeVip();
        beVip.id = id;
        beVip.title = title;
        beVip.content = content;
        beVip.timeQuantum = timeQuantum;
        beVip.dt = dt;
        beVip.audioUrl = audioUrl;
        beVip.chatLogs = chatLogs;
        beVip.teacher = teacher;
        beVip.teacherIcon = teacherIcon;
        beVip.unread = unread;
        beVip.state = state;
        return beVip;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getTimeQuantum() {
        return timeQuantum;
    }

    public void setTimeQuantum(String timeQuantum) {
        this.timeQuantum = timeQuantum;
    }

    public Date getDt() {
        return dt;
    }

    public void setDt(Date dt) {
        this.dt = dt;
    }

    public String getAudioUrl() {
        return audioUrl;
    }

    public void setAudioUrl(String audioUrl) {
        this.audioUrl = audioUrl;
    }

    public Collection<BeVipChatLog> getChatLogs() {
        return chatLogs;
    }

    public void setChatLogs(Collection<BeVipChatLog> chatLogs) {
        this.chatLogs = chatLogs;
    }

    public String getTeacher() {
        return teacher;
    }

    public void setTeacher(String teacher) {
        this.teacher = teacher;
    }

    public String getTeacherIcon() {
        return teacherIcon;
    }

    public void setTeacherIcon(String teacherIcon) {
        this.teacherIcon = teacherIcon;
    }

    public boolean isUnread() {
        return unread;
    }

    public void setUnread(boolean unread) {
        this.unread = unread;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }
}
